package tang.com.test.activity;

import android.content.ComponentName;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import tang.com.test.R;

public class DBActivity extends AppCompatActivity implements View.OnClickListener {

    private EditText mEditText;
    private Button mButton;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_db);
        init();
    }

    private void init() {
       mEditText =(EditText) findViewById(R.id.EditText);
       mButton = (Button) findViewById(R.id.Button);
        mButton.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        String id=mEditText.getText().toString();
        if(id == null || id.isEmpty()){
            Toast.makeText(DBActivity.this,"请输入影片id",Toast.LENGTH_LONG).show();
            return;
        }
        startAct(id);
    }
    private void startAct(String id) {
        Intent intent = new Intent();
        ComponentName comp = new ComponentName("","");
        intent.setComponent(comp);
        intent.putExtra("vid",id);
        startActivity(intent);
    }
}
